//流程模块【tyjzbcgnew.装备采购流程NEW】下录入页面自定义js页面,初始函数 
var base_ranking_tyjzbcgnew = $("#base_ranking").val();
var base_deptname_tyjzbcgnew = $("input[name='base_deptname']").val();
function initbodys(){
	getDirector();
	getSign();
	// console.log(regExp.filter('采购联系方式', '15012345678', 'telOrMobile'));
	var o = document.getElementById("shenqingb");
	if(o != null)  {
		var w = o.offsetWidth;  //宽度
		//将宽度值bai赋给另一个div
		$("#xinz").width(w);
	}

	if(base_ranking_tyjzbcgnew == "项目发起人" || base_ranking_tyjzbcgnew == "项目负责人" || base_ranking_tyjzbcgnew == "采购科科长") {
		$(".secdata").hide();
		var objs = $(".inputs");
		var hideIdStr = "aftercheckmoney,zbmoney,savemoney,saverate,proxygov,signupcompany,wbtime,issignagreement,projectfiles,receiverdate,jszbzzqdrq,projecticp,proicptime,projectadminer,buymode";
		var idLikeArr = hideIdStr.split(",");
		for(var i=0;i<objs.length;i++){
			for (var j=0;j<idLikeArr.length;j++){
				if(objs[i].name.startWith(idLikeArr[j])) {
					$("[name='"+objs[i].name+"']").parent().hide();
				}
			}
			
		}
	}
}

function afterAddRow(){
	initbodys();
}

function changesubmit(d) {
	var projectname = regExp.filter('文件名称', d.projectname, 'chsDash');
	if(projectname.bool == false) return projectname.msg;
	var symbol = regExp.filter('文号', d.symbol, 'chsDash');
	if(symbol.bool == false) return symbol.msg;
	var linktel = regExp.filter('联系电话', d.linktel, 'telOrMobile');
	if(linktel.bool == false) return linktel.msg;
	var processer = regExp.filter('经办人', d.processer, 'name');
	if(processer.bool == false) return processer.msg;
	var companyadminer = regExp.filter('单位负责人', d.companyadminer, 'name');
	if(companyadminer.bool == false) return companyadminer.msg;
	var companyAddress = regExp.filter('单位地址', d.company_address, 'chsDash');
	if(companyAddress.bool == false) return companyAddress.msg;
}

//获取单位负责人公章
function getSign(params = {}) {
	if(mid != 0) {
		params.mid = mid;
		js.ajax(js.getajaxurl('getCompanySign','other|index','cg'),params,function(s){
			if(s.code != 300) {
				$("#companySign").html('<img src=\"'+s.data.path+'\" height="130" width="130"/>');
				$("#companySign").css({"position":"relative", "left":"-30px"});
			}
		},'get,json',false,'');
	}
}

//获取单位负责人
function getDirector() {
	if(mid == 0) {
		js.ajax(js.getajaxurl('getDirector','other|index','cg'), {'director':base_deptname_tyjzbcgnew},function(s){
			if(s.code != 300) {
				$("input[name='companyadminer']").val(s.data.director);
			}
		},'get,json',false,'');
	}
}


